#!/usr/bin/env python3

import sys

failed = False

tbman_lines = []
uart_lines = []

for line in open(sys.argv[1]).readlines():
	if line.startswith("TBMAN:"):
		tbman_lines.append(line.strip()[7:])
	elif line.startswith("UART:"):
		uart_lines.append(line.strip()[6:])

try:
	failed = failed or tbman_lines[0] != "Hello, tbman!"
	failed = failed or not tbman_lines[1].startswith("CPU requested termination")
	failed = failed or tbman_lines[1].split(" ")[-1] != "0"
	failed = failed or uart_lines[0] != "Hello, UART!"
except:
	failed = True

if not failed:
	print("Test PASSED.")